<?php /*
	
*/ ?>
<?php include("inc/head.inc.php") ?>
<body>
<table width="824" border="0" cellpadding="0" cellspacing="0"  align="center">
  <tr>
    <td class="headerclass"><?php include(INC."top.inc.php") ?></td>
  </tr>
  <tr>
    <td valign="top" class="maincontainer"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr><td valign="top"class="leftmenuback"><?php include(INC."left.inc.php") ?></td>
        <td valign="top">
		<table cellpadding="0" cellspacing="0">
		<tr>
		<td align="left" valign="top" >
	<?php 
	if((isset($_REQUEST['view']) && ($_REQUEST['view'])=="on") || (isset($_REQUEST['view']) && ($_REQUEST['view'])=="giftidea"))
	{
	?>
	<table width="100%" height="130" border="0" align="center" cellpadding="0" cellspacing="0">
	<?php 
	{
	 if(isset($_REQUEST['view']) && ($_REQUEST['view'])=="on")
		{
		/////////////  SPECIAL OFFER CODE ///////////////////
		$type=1;
		
		$sql="select * from tblideas where inttype=1 and intstatus='0'";
		$resrand=$n02586916_db->select($sql);
		if(count($resrand)>0)
		{
			for($i=0;$i<count($resrand);$i++)
			{
			$giftrand=$giftrand.$resrand[$i]['intid'].",";
			}
		}
		$giftrand = substr($giftrand, 0, -1); 
		$gft=explode(",",$giftrand);
		}
	else if(isset($_REQUEST['view']) && ($_REQUEST['view'])=="giftidea")
		{
		$type=2;
		
		/////////////// GIFT CODE CODING /////////////////////
		
		$sql="select * from tblideas where inttype=2 and intstatus='0'";
		$resspec=$n02586916_db->select($sql);
		if(count($resspec)>0)
		{
            for($i=0;$i<count($resspec);$i++)
			{
			$giftrand=$giftrand.$resspec[$i]['intid'].",";
			}		
		}
		$giftrand = substr($giftrand, 0, -1); 
		$gft=explode(",",$giftrand);
		}


		shuffle($gft);
		shuffle($gft);
		shuffle($gft);
       	//    echo $gft[0];
				
	  $itemid=$gft[0];
	    //echo $itemid;
	  	$sql="select * from tblideas where inttype='$type' and intid='$itemid'";
		//echo $sql;
		$res=$n02586916_db->select($sql);
		if(count($res)>0)
		{	
			/*$tmpvaluetkn="";
			if(isset($_SESSION['rndnewval']))
			{
				$tmpvaluetkn=$_SESSION['rndnewval'];
			}
			$countoffer=count($res);
			
			do
			{
				$randomcount=rand(0,$countoffer-1);
				$_SESSION['rndnewval']=$randomcount;
			}while($_SESSION['rndnewval']==$tmpvaluetkn);
			$sql="select * from tblideas Limit ".$randomcount.",1";
			//echo $sql;
			$res=$n02586916_db->select($sql);
			
			if(count($res)>0)
			{*/
			$id=$res[0]['intid'];
				$sqlgift="select * from tblprodgiftideas where intgiftideaid='$id'";
				$resgift=$n02586916_db->select($sqlgift);
				if($resgift)
				{
				$giftid=$resgift[0]['intprodid'];
				$sql6="select * from tblproducts where intprodid='$id' and intstatus=1";
				  $resprname=$n02586916_db->select($sql6);
				  if(count($resprname)>0)
				  {
				  $proprice11=$resprname[0]['decprice'];
	  ?>
      <tr>
        <td height="21" colspan="3" class="specialtop"><table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
			
		   <td style="width:1px;"></td>
		   <td height="22" bgcolor="#000000" class="style1" style="padding-left:14px;"><?php echo $res[0]['vargiftideatitle'];?></td>
		   <td style="width:1px;"></td>
		   </tr>
        </table></td>
      </tr>
	  
      <tr>
	  
        <td width="42%" class="specialreapet"><table width="100%" height="130" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" class="left_back">
          <tr>
            <td height="22" colspan="2" class="fntstyle">&nbsp;
                <?php
				$sqlprdes="select * from tblproddesc where intid='$giftid'";
				$respname=$n02586916_db->select($sqlprdes);
				
				echo $respname[0]['varprodname'];
				$desc=$respname[0]['txtdesc'];
				?></td>
            <td width="100" align="center" class="fntstyle">&pound;
                <?php echo $proprice11;?></td>
          </tr>
          <tr>
            <td width="48" rowspan="2" align="center"><a href="proddetail.php?proid=<?php echo $respro[$h]['intprodid'];?>"><img src="images/product/<?php echo $resprname[0]['intproddefaultimg'];?>" border="0" /></a></td>
            <td colspan="2" align="left" class="font"><?php
			  
			  //$desctxt=$sql[$j]['vartext'];

				if(strlen($desc) > 45 )
				{
				$desc=substr($desc,0,45); 
				$desc=$desc."...";
				//echo $desctxt;
				}
				echo srchwordchangestyl($desc);

			  ?>
            </td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="right"><a class="aa" href="proddetail.php?proid=<?php echo $giftid;?>">More...</a><a href="proddetail.php?proid=<?php echo $respro[$h]['intprodid'];?>"></a></td>
          </tr>
        </table></td>
        <td width="38%" align="center" class="font"><p><?php echo $res[0]['vardesc'];?></p>
          <p><a href="proddetail.php?proid=<?php echo$giftid;?>" class="aa"><img src="images/buynow.jpg" border="0" /></a></p></td>
        <td width="20%" class="specialreapet"><img src="images/ideas/th/<?php echo $res[0]['varthimg'];?>" height="75" width="75" /></td>
      </tr><?php }}}?>
    </table>
	<?php }}?>
      <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
        
        <tr>
          <td><?php
		  if(isset($_REQUEST['view']) && ($_REQUEST['view'])=="on")
				{
				?>
		  <table width="100%" border="0" cellpadding="0" cellspacing="1" class="proborder">
            <tr>
			
          <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;" colspan="4"><span class="catnamerep">&nbsp;Special Offers </span></td>
        </tr>
			<tr>
              <td height="23" colspan="3" class="feature_headingbg">&nbsp;&nbsp;&nbsp; &nbsp; </td>
              </tr>
			<?php 
				
				$sql="select * from tblideas where inttype=1 and intstatus='0'";
				$res=$n02586916_db->select($sql);
				if(count($res)>0)
				{
					for($i=0;$i<count($res);$i++)
					{
			?>
            <tr>
              <td width="22%">&nbsp;&nbsp;&nbsp;<a href="specialoffer.php?specialid=<?php echo $res[$i]['intid'];?>" class="aa"><img src="images/ideas/th/<?php echo $res[$i]['varthimg'];?>" height="75" width="75"  border="0"/></a></td>
              <td width="18%" align="center"><a href="specialoffer.php?specialid=<?php echo $res[$i]['intid'];?>" class="aa">
                <strong><?php echo $res[$i]['vargiftideatitle'];?></strong>
              </a></td>
              <td width="60%" align="center" class="fontsmall"><?php echo $res[$i]['vardesc'];?></td>
            </tr><?php }}?>
          </table>
		  <?php }?>		
		   <?php 
				if(isset($_REQUEST['view']) && ($_REQUEST['view'])=="giftidea")
				{
				?>
		  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="proborder">
              <tr>
                <td height="23" class="search" bgcolor="#E9E9E9" style="border:1px solid #999999;" colspan="4"><span class="catnamerep">&nbsp;Gift Ideas</span></td>
              </tr>
              <tr>
                <td height="23" colspan="3" align="center" class="feature_headingbg">&nbsp;&nbsp; </td>
              </tr>
			
		    <?php 
				
				$sql="select * from tblideas where inttype=2 and intstatus='0'";
				$res=$n02586916_db->select($sql);
				if(count($res)>0)
				{
					for($i=0;$i<count($res);$i++)
					{
			?>
		    <tr>
		      <td width="22%" align="center">&nbsp;&nbsp;<img src="images/ideas/th/<?php echo $res[$i]['varthimg'];?>" height="75" width="75" /><a href="specialoffer.php?giftid=<?php echo $res[$i]['intid'];?>" class="aa"></a></td>
              <td width="18%" align="center"><a href="specialoffer.php?giftid=<?php echo $res[$i]['intid'];?>" class="aa">
                <strong><?php echo $res[$i]['vargiftideatitle'];?></strong>
              </a></td>
              <td width="60%" align="center"><span class="fontsmall">
                <?php echo $res[$i]['vardesc'];?>
              </span></td>
		    </tr><?php }}?>
	      </table>		  
		  <?php }?>	
		  <?php
		  if(isset($_REQUEST['specialid']) && ($_REQUEST['specialid'])!="")
		{
			?><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="23" colspan="2" class="head"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
			
		   <td style="width:1px;"></td>
		   <td height="22" bgcolor="#000000" class="style1" style="padding-left:14px;">Products</td>
		   <td style="width:1px;"></td>
		   </tr>
          </table></td>
        </tr>
		<?php 
			$speid=$_REQUEST['specialid'];
			$sql="select * from tblprodgiftideas where intgiftideaid='$speid'";
			$resgid=$n02586916_db->select($sql);
			if(count($resgid)>0)
			{
				for($p=0;$p<count($resgid);$p++)
				{
					//echo $resgid[$p]['intprodid']."<br>";
					$prid=$resgid[$p]['intprodid'];
			 $sql6="select * from tblproddesc where intid='$prid'";
			  $resprname1=$n02586916_db->select($sql6);
			 if(count($resprname1)>0)
			 {
				$desc=$resprname1[0]['txtdesc'];
				
				$resprname1=$resprname1[0]['varprodname'];
				
			 }
			 else
			 {
			 	$resprname1="";
			 }
			  $sql6="select * from tblproducts where intprodid='$prid'";
			 
			  $resprname=$n02586916_db->select($sql6);
			  if(count($resprname)>0)
			  {
			  $proprice=$resprname[0]['decprice'];
		?>

        <tr>
          <td width="50%"><table width="100%" height="170" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" class="proborder">
            <tr>
              <td height="25" colspan="2" class="fntstyle">&nbsp;<?php echo $resprname1;?></td>
              <td width="31%" height="25" align="center" class="fntstyle">&pound;<?php echo $proprice;?></td>
            </tr>
            <tr>
              <td width="29%" rowspan="2">
			  <a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"><img src="images/product/<?php echo $resprname[0]['intproddefaultimg'];?>" border="0"/></a>			  <?php }?>			  </td>
              <td colspan="2" align="left" class="font"><?php
			  
			  //$desctxt=$sql[$j]['vartext'];

				if(strlen($desc) > 45 )
				{
				$desc=substr($desc,0,45); 
				$desc=$desc."...";
				//echo $desctxt;
				}
				echo srchwordchangestyl($desc);

			  ?>
                <p>&nbsp;</p></td>
            </tr>
            <tr>
              <td colspan="2" align="right" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa">More...</a></td>
            </tr>
            <tr>
              <td width="29%" align="center" class="font"><?php 
			  $sql1="select tblprodgiftideas.*,tblideas.* from tblprodgiftideas,tblideas where intprodid='$prid' and tblprodgiftideas.intgiftideaid=tblideas.intid and tblideas.intstatus=1";
		  		$res1=$n02586916_db->select($sql1);
				if($res1)
				{
				$offer= $res1[0]['vargiftideatitle'];
				}
				else{$offer="";}
		  
			 echo '<span class="msg1">'.$offer.'</span>';?></td>
              <td colspan="2" align="left" valign="top" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"><img src="images/buynow.jpg" width="107" height="25" border="0"/></a></td>
            </tr>
          </table></td>
		  <?php 
		  	$p++;
			if(isset($resgid[$p]))
			{
			 $id=$resgid[$p]['intprodid'];
			 $sql6="select * from tblproddesc where intid='$id'";
			  $resprname1=$n02586916_db->select($sql6);
			 if(count($resprname1)>0)
			 {
			 	$desc=$resprname1[0]['txtdesc'];
			 	$resprname1=$resprname1[0]['varprodname'];
			 }
			 else
			 {
			 	$resprname1="";
			 }
			
			  $sql6="select * from tblproducts where intprodid='$id'";
			 
			  $resprname=$n02586916_db->select($sql6);
			  if(count($resprname)>0)
			  {
			   $proprice=$resprname[0]['decprice'];
		  ?>
          <td width="50%"><table width="100%" height="170" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" class="proborder">
            <tr>
              <td height="22" colspan="2" class="fntstyle">&nbsp;<?php echo $resprname1;?></td>
              <td width="31%" align="center" class="fntstyle">&pound;<?php echo $proprice;?></td>
            </tr>
            <tr>
              <td width="72" rowspan="2" align="center">
			  <a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"><img src="images/product/<?php echo $resprname[0]['intproddefaultimg'];?>" border="0"/></a>			  <?php }?></td>
              <td colspan="2" align="left" class="font">
			  <?php
			  
			  //$desctxt=$sql[$j]['vartext'];

				if(strlen($desc) > 45 )
				{
				$desc=substr($desc,0,45); 
				$desc=$desc."...";
				//echo $desctxt;
				}
				echo srchwordchangestyl($desc);

			  ?>
                  <p class="font">&nbsp;</p></td>
            </tr>
            <tr>
              <td colspan="2" align="right" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa">More...</a></td>
            </tr>
            <tr>
              <td width="72" align="center" class="font"><?php 
			  $sql1="select tblprodgiftideas.*,tblideas.* from tblprodgiftideas,tblideas where intprodid='$prid' and tblprodgiftideas.intgiftideaid=tblideas.intid and tblideas.intstatus=1";
		  		$res1=$n02586916_db->select($sql1);
				if($res1)
				{
				$offer= $res1[0]['vargiftideatitle'];
				}
				else{$offer="";}
		  
			 echo '<span class="msg1">'.$offer.'</span>';?></td>
              <td colspan="2" align="left" valign="top" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"><img src="images/buynow.jpg" width="107" height="25" border="0"/></a><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="ab"></a></td>
            </tr>
          </table></td>
        </tr> <?php }
			}
		}else{echo '<span class="msg">No Products Found in this Offer</span>';}?>
      </table>
		  <?php 
			}
		  if(isset($_REQUEST['giftid']) && ($_REQUEST['giftid'])!="")
		{
			?>
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
            <tr>
              <td height="23" colspan="2" class="head"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
			
		   <td style="width:1px;"></td>
		   <td height="22" bgcolor="#000000" class="style1" style="padding-left:14px;">Products</td>
		   <td style="width:1px;"></td>
		   </tr>
              </table></td>
            </tr>
            <?php 
			$speid=$_REQUEST['giftid'];
			$sql="select * from tblprodgiftideas where intgiftideaid='$speid'";
			$resgid=$n02586916_db->select($sql);
			if(count($resgid)>0)
			{
				for($p=0;$p<count($resgid);$p++)
				{
					//echo $resgid[$p]['intprodid']."<br>";
					$prid=$resgid[$p]['intprodid'];
			 $sql6="select * from tblproddesc where intid='$prid'";
			  $resprname1=$n02586916_db->select($sql6);
			 if(count($resprname1)>0)
			 {
			 	$desc=$resprname1[0]['txtdesc'];
			 	$resprname1=$resprname1[0]['varprodname'];
			 }
			 else
			 {
			 	$resprname1="";
			 } $sql6="select * from tblproducts where intprodid='$prid'";
			 
			  $resprname=$n02586916_db->select($sql6);
			  if(count($resprname)>0)
			  {
			  $proprice=$resprname[0]['decprice'];
		?>
            <tr>
              <td width="50%"><table width="100%" height="170" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" class="proborder">
                  <tr>
                    <td height="22" colspan="2" class="fntstyle">&nbsp;
                        <?php echo $resprname1;?></td>
                    <td width="31%" align="center" class="fntstyle">&pound;<?php echo $proprice;?></td>
                  </tr>
                  <tr>
                    <td width="29%" rowspan="2"><span class="specialreapet">
                     <a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"> <img src="images/product/<?php echo $resprname[0]['intproddefaultimg'];?>" border="0"/></a>
                      <?php }?>
                    </span></td>
                    <td colspan="2" align="left" class="font"><?php 
			  if(strlen($desc) > 45 )
				{
				$desc=substr($desc,0,45); 
				$desc=$desc."...";
				//echo $desctxt;
				}
				echo srchwordchangestyl($desc);
				?>
                      <p>&nbsp;</p></td>
                  </tr>
                  <tr>
                    <td colspan="2" align="right" class="font"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa">More...</a></td>
                  </tr>
                  <tr>
                    <td width="29%" align="center" class="font"><?php 
			  $sql1="select tblprodgiftideas.*,tblideas.* from tblprodgiftideas,tblideas where intprodid='$prid' and tblprodgiftideas.intgiftideaid=tblideas.intid and tblideas.intstatus=1";
		  		$res1=$n02586916_db->select($sql1);
				if($res1)
				{
				$offer= $res1[0]['vargiftideatitle'];
				}
				else{$offer="";}
		  
			 echo '<span class="msg1">'.$offer.'</span>';?></td>
                    <td colspan="2" align="left" valign="top" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"><img src="images/buynow.jpg" width="107" height="25" border="0"/></a></td>
                  </tr>
              </table></td>
              <?php 
		  	
		  	$p++;
			if(isset($resgid[$p]))
			{
			 $id=$resgid[$p]['intprodid'];
			 $sql6="select * from tblproddesc where intid='$id'";
			  $resprname1=$n02586916_db->select($sql6);
			 if(count($resprname1)>0)
			 {
			 	$desc=$resprname1[0]['txtdesc'];
			 	$resprname1=$resprname1[0]['varprodname'];
			 }
			 else
			 {
			 	$resprname1="";
			 }
			 $sql6="select * from tblproducts where intprodid='$id'";
			 
			  $resprname=$n02586916_db->select($sql6);
			  if(count($resprname)>0)
			  {
			   $proprice=$resprname[0]['decprice'];
		  ?>
              <td width="50%"><table width="100%" height="170" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" class="proborder">
                  <tr>
                    <td height="22" colspan="2" class="fntstyle">&nbsp;
                        <?php echo $resprname1;?></td>
                    <td width="31%" align="center" class="fntstyle">&pound;<?php echo $proprice;?></td>
                  </tr>
                  <tr>
                    <td width="29%" rowspan="2"><span class="specialreapet">
                     <a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"> <img src="images/product/<?php echo $resprname[0]['intproddefaultimg'];?>" border="0"/></a>
                      <?php }?>
                    </span></td>
                    <td colspan="2" align="left" class="font"><?php 
			  if(strlen($desc) > 45 )
				{
				$desc=substr($desc,0,45); 
				$desc=$desc."...";
				//echo $desctxt;
				}
				echo srchwordchangestyl($desc);
				?>
                      <p class="fontsmall">&nbsp;</p></td>
                  </tr>
                  <tr>
                    <td colspan="2" align="right" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa">More...</a></td>
                  </tr>
                  <tr>
                    <td width="29%" align="center"><?php 
			  $sql1="select tblprodgiftideas.*,tblideas.* from tblprodgiftideas,tblideas where intprodid='$prid' and tblprodgiftideas.intgiftideaid=tblideas.intid and tblideas.intstatus=1";
		  		$res1=$n02586916_db->select($sql1);
				if($res1)
				{
				$offer= $res1[0]['vargiftideatitle'];
				}
				else{$offer="";}
		  
			 echo '<span class="msg1">'.$offer.'</span>';?></td>
                    <td colspan="2" align="left" valign="top" class="fontsmall"><a href="proddetail.php?proid=<?php echo $resprname[0]['intprodid'];?>" class="aa"><img src="images/buynow.jpg" border="0"/></a></td>
                  </tr>
              </table></td>
            </tr>
            <?php }
			}
		}else{echo '<span class="msg">No Products Found in this Offer</span>';}?>
          </table>
          <?php 	
			}
		  ?>          </td>
        </tr> 
    </table></td>
		</tr>
			</table>		</td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td><?php include "inc/bottom.inc.php"; ?></td>
  </tr>
</table>
</body>
</html>
